#!/usr/bin/env bash

# Turn off echo 关闭回显
set +x

# 将工作目录设置为脚本所在目录
# shellcheck disable=SC2164
cd "$(dirname "$0")"

git remote -v
git fetch
git rebase origin/master

coreFolder="UICore"
if [ -d "$PWD/$coreFolder" ]; then
    # shellcheck disable=SC2164
    cd $coreFolder
    echo "准备拉取仓库：$coreFolder"
    git remote -v
    git fetch
    git rebase origin/master
    # shellcheck disable=SC2103
    cd ..
else
    echo "准备克隆仓库：$coreFolder"
    git clone git@github.com:angcyo/UICore.git
fi

extendFolder="UICoreEx"
if [ -d "$PWD/$extendFolder" ]; then
    # shellcheck disable=SC2164
    cd $extendFolder
    echo "准备拉取仓库：$extendFolder"
    git remote -v
    git fetch
    git rebase origin/master
    # shellcheck disable=SC2103
    cd ..
else
    echo "准备克隆仓库：$extendFolder"
    git clone git@github.com:angcyo/UICoreEx.git
fi

read -n 1 -s -r -p "!结束! Press any key to continue..."
